/*
 * NumberListFile.h
 *
 *  Created on:  Jun 12, 2009
 *      Author:  Zach Riggle A37627537
 *      Project: CSE410 Project 2
 */

#ifndef NUMBERLISTFILE_H_
#define NUMBERLISTFILE_H_

#include <string>
#include <vector>
#include "Log.h"
#include "RegularExpression.h"

using namespace std;

/**
 * Loads the number list from a file, saves it to a file.
 * Performs verification to skip over lines that do not consist SOLELY of a number and whitespace.
 */
class NumberListFile {
public:
    NumberListFile();
    NumberListFile(string filename);
    virtual ~NumberListFile();

    /**
     * Loads numbers from a file.  One number per line.
     * @return The number (count) of numbers loaded.  -1 if an error occurred.
     */
    int load(string filename);

    /**
     * Saves numbers to a file.  One number per line.
     * @return The number (count) of numbers saved. -1 if an error occurred.
     */
    int save(string filename);

    /**
     * @return A vector that contains all of the numbers.
     */
    vector<int> getNumbers();

    /**
     * Sets the internal number list.
     */
    void setNumbers(vector<int> v);
protected:
    vector<int> numberList;

    static RegularExpression number;
};

#endif /* NUMBERLISTFILE_H_ */
